package com.guomao.demoa;

import java.util.Comparator;
import java.util.TreeSet;

public class JavaDemo2 {

    public static void main(String[] args) {

//        Runnable r = new MyRunImpl();
//
//        Thread t1 = new Thread(r);
//        Thread t2 = new Thread(r);

//        new Thread(r);//匿名对象


//        Runnable r = new Runnable() {
//            @Override
//            public void run() {
//                for (int i = 0; i < 100; i++) {
//                    System.out.println(i);
//                }
//            }
//        };
//
//        Thread t1 = new Thread(r);
//        Thread t2 = new Thread(r);

        TreeSet<Student> ts = new TreeSet<>(new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                return 0;
            }
        });

        Thread t = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println(i);
                }
            }
        });

        t.start();


        new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println(i);
                }
            }
        }).start();


        new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println(i);
            }
        }).start();
    }
}
